gusucode.com > MATLAB与控制系统仿真实践 源代码 > MATLAB与控制系统仿真实践 源代码/第十二章/eg12_7.m

    t=0:0.1:100;
for T=[1 5 10 ]
G=tf([1],[T 1]);
impulse(G,t);
hold on
end
title('系统1/(Ts+1)脉冲响应曲线.T取1,5,10','Fontsize',12);

%第二种方式
t=0:0.1:100;
T=[1 5 10]
for n=1:3
G=tf([1],[T(n) 1]);
y(:,n)=impulse(G,t);
end
plot(t,y)
title('系统1/(Ts+1)脉冲响应曲线.T取1,5,10','Fontsize',16);
xlabel('\itt'),ylabel('\ity');
figure(2);

subplot(2,2,1)
plot(t,y(:,1));title('T=1');
xlabel('\itt'),ylabel('\ity');
subplot(2,2,2)
plot(t,y(:,2));title('T=5');
xlabel('\itt'),ylabel('\ity');
subplot(2,2,3)
plot(t,y(:,3));title('T=10');
xlabel('\itt'),ylabel('\ity');